#Agregar ruido a la imagen

import random
import pylab
import scipy.stats

N = 1000.

def gaussianNoise(img, min_p, max_p, sigma, z):
    result = pylab.empty((img.shape[0], img.shape[1], img.shape[2]), dtype = float)
    
    for i in xrange(img.shape[0]):
        for j in xrange(img.shape[1]):
            for k in xrange(z, z + 1):
                value = random.uniform(min_p, max_p)                
                result[i, j, k] = img[i, j, k] * scipy.stats.norm.pdf(value, 0, sigma)
    
    return result   
